package com.learn;

import java.util.ArrayList;

public class Main {
    public static void main(String[] args) {
        Main main1 = new Main();
        PCB pcb = main1.initPCB2();
        pcb.operation();
        return;
    }


    public PCB initPCB1(){
        PCB pcb = new PCB();
        ArrayList<Paragraph> paragraphArrayList = new ArrayList<>();
        paragraphArrayList.add(new Paragraph(100,null,0,"主进程控制块"));
        paragraphArrayList.add(new Paragraph(50,null,200,"数据区"));
        paragraphArrayList.add(new Paragraph(50,null,250,"子进程控制块"));
        pcb.setParagraphList(paragraphArrayList);
        pcb.setPageLength(-1);
        pcb.setFlag(true);
        return pcb;
    }
    public PCB initPCB2(){
        PCB pcb = new PCB();

        pcb.setPageLength(20);

        ArrayList<Paragraph> paragraphArrayList = new ArrayList<>();
        ArrayList<Page> pages = new ArrayList<>();
        pages.add(new Page(3));
        pages.add(new Page(4));
        pages.add(new Page(5));
        pages.add(new Page(7));
        pages.add(new Page(8));
        Paragraph paragraph = new Paragraph(-1, pages, 0, "主进程控制块");
        paragraphArrayList.add(paragraph);

        pages = new ArrayList<>();
        pages.add(new Page(7));
        pages.add(new Page(9));
        pages.add(new Page(10));
        paragraph=new Paragraph(-1,pages,-1,"数据区");
        paragraphArrayList.add(paragraph);

        pcb.setParagraphList(paragraphArrayList);
        return pcb;
    }
}
